<template>
  <div class="header">
    <div class="row">
      <div class="title col-lg-2 col-md-3 col-sm-12">
        <RouterLink to="/home"> Blog Viewer </RouterLink>
      </div>
      <div class="menu-item col-lg-1 col-md-2 col-sm-12">
        <RouterLink to="/home">Home</RouterLink>
      </div>
      <div class="menu-item col-lg-1 col-md-2 col-sm-12">
        <RouterLink to="/categories">Categories</RouterLink>
      </div>
      <div
        class="div-search col-lg-2 col-md-3 col-sm-12 offset-lg-6 offset-md-2"
      >
        <input
          class="search-box"
          type="text"
          placeholder="Search"
          @change="inputChanged"
        />
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import router from "@/router";

let inputChanged = (e: Event) => {
  let value = (e.target as HTMLInputElement).value;
  router.push({ path: "/search", query: { q: encodeURI(value) } });
};
</script>

<style scoped>
.row {
}

.row > * {
  height: 40px;
}

.title {
  padding-top: 2px;
  text-align: center;
  background-color: #66b2ff;
}

.title a {
  text-decoration: none;
  font-size: x-large;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  color: #1919b3;
}

.div-search {
  padding-top: 5px;
}

.search-box {
  width: 100%;
  height: 32px;
  padding-left: 16px;
  padding-right: 16px;
  border: 2px solid #808080;
  border-radius: 16px;
  font-family: Arial, Helvetica, sans-serif;
}

.menu-item {
  padding-top: 8px;
  text-align: center;
  font-family: Arial, Helvetica, sans-serif;
}

.menu-item a {
  text-decoration: none;
  font-size: large;
  color: black;
}
</style>
